package com.kotasoft.ejemplohibernatevalidation;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import javax.validation.Constraint;
import javax.validation.Payload;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

@NotEmpty(message = "{persona.dni.vacio}")
@Length(min = 9, max = 9, message = "{persona.dni.longitudincorrecta}")
@Target({ METHOD, FIELD, ANNOTATION_TYPE })
@Retention(RUNTIME)
@Constraint(validatedBy = DNIValidator.class)
@Documented
public @interface DNIConstraint {

	String message() default "{persona.dni.formatoincorrecto}";

	Class<?>[] groups() default {};

	Class<? extends Payload>[] payload() default {};
}
